﻿
@{
    Layout = "~/Views/Shared/_Index.cshtml";
}
<div class="topPanel">
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group" style="float:left;">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="姓名/工号" style="width: 180px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div style="padding:0px 10px;" class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>

<script>

    $(function () {
        gridListInit();
        $("#btn_search").click(function () {
            $("#gridList").jqGrid('setGridParam', {
                postData: { dutyCode: "", keyword: $("#txt_keyword").val() },
            }).trigger('reloadGrid');
        });
    });

    function gridListInit() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            rownumbers: false,
            url: "/SystemManage/Common/GetStaffListByDutyCode",
            postData: { dutyCode: "", keyword: $("#txt_keyword").val() },
            height: 235, 
            colModel: [
                { label: "工号", name: "StaffGh", width: 80 },
                { label: "姓名", name: "StaffName", width: 100 },
                { label: "岗位", name: "DutyCode", width: 80 }
            ],
            pager: "#gridPager",
            sortname: 'StaffName',
            viewrecords: false,
            rowNum: 10,
        });


    }

    function AcceptClick(callBack) {

        var seleRowid = jQuery("#gridList").jqGrid("getGridParam", "selrow");
        if (!(seleRowid)) {
            $.modalAlert("请选中一条信息", 'warning');
            return;
        }
        if (seleRowid != null && seleRowid != undefined) {
            var rowData = $("#gridList").jqGrid('getRowData', seleRowid);
            $.modalClose();
            return rowData;
        }
    }
</script>